package com.sia.springcloud.heartProtect;

import lombok.Data;

/**
 * @Author: Sirius
 * @Date: 2021/12/30 14:24
 * @Description:
 **/
@Data
public class InstanceInfo implements Comparable<InstanceInfo> {
    private String heartbeatId;
    private String instanceId;
    private String protocolName;
    private Integer deviceCount;
    private long time;


    /**
     * 重写compareTo方法，通过DeviceNum比较大小
     * <p>
     * 从小到大进行排序，deviceNum越小优先级越高
     *
     * @param o
     * @return
     */
    @Override
    public int compareTo(InstanceInfo o) {

        return this.getDeviceCount() - o.getDeviceCount();
    }
}
